package com.JingYan.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.JingYan.domain.SysUser;
import com.JingYan.service.SysUserService;
import com.JingYan.mapper.SysUserMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

/**
* @author DongJiaQi
* @description 针对表【sys_user(用户信息表)】的数据库操作Service实现
* @createDate 2022-10-14 08:59:10
*/
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
    implements SysUserService{
    /**
     * 业务日志
     * logback-spring.xml 中需要有 logger标签 name是 business_log
     */
    protected final Logger businessLog = LoggerFactory.getLogger("business_log");


    @Lazy
    @Autowired
    SysUserServiceImpl self;
    @Override
    @Cacheable(value = "getByid#30*5",keyGenerator ="keyGenerator" )
    public List<SysUser> getByid(long id){
        List<SysUser> list = self.list(new QueryWrapper<SysUser>().eq("user_id", id));
        businessLog.info("查询用户");
        return list;
    }
}




